<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <!-- 引入组件库 -->
    <script src="../plugins/jquery/jquery.min.js"></script>
    <script src="../plugins/vue/vue.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <script src="../plugins/vue/axios-0.18.0.js"></script>
    <style>
        .avatar-uploader .el-upload {
            border: 1px dashed #d9d9d9;
            border-radius: 6px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }
        .avatar-uploader .el-upload:hover {
            border-color: #409EFF;
        }
        .avatar-uploader-icon {
            font-size: 28px;
            color: #8c939d;
            width: 178px;
            height: 178px;
            line-height: 178px;
            text-align: center;
        }
        .avatar {
            width: 178px;
            height: 178px;
            display: block;
        }
        .datatable {
            position: relative;
            box-sizing: border-box;
            -webkit-box-flex: 1;
            width: 100%;
            max-width: 100%;
            font-size: 14px;
            color: rgb(96, 98, 102);
            overflow: hidden;
            flex: 1 1 0%;
        }
        .datatable td, .datatable th {
            padding: 12px 0;
            min-width: 0;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            text-overflow: ellipsis;
            vertical-align: middle;
            position: relative;
            text-align: left;
        }
    </style>

</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>传智健康<small>历史预约记录</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>传智健康</el-breadcrumb-item>
            <el-breadcrumb-item>历史预约记录</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div class="app-container">
        <div class="box">
            <div class="filter-container">
                <template>
                    <div class="block">
                        <span class="demonstration"></span>
                        <el-date-picker
                                v-model="pagination.queryString"
                                type="datetimerange"
                                range-separator="至"
                                start-placeholder="开始日期"
                                end-placeholder="结束日期">
                        </el-date-picker>
                        <el-button @click="pagination.currentPage=1; findPage()" class="dalfBut">查询</el-button>
                    </div>
                </template>

            </div>
            <el-table size="small" current-row-key="id" :data="dataList" stripe highlight-current-row>
                <el-table-column type="index" align="center" label="序号"></el-table-column>
                <el-table-column prop="orderType" label="预约类型" align="center"></el-table-column>
                <el-table-column prop="orderDate" label="预约日期" align="center"></el-table-column>
                <el-table-column prop="orderStatus" label="预约状态" align="center"></el-table-column>
                <el-table-column  prop="setmealName" label="预约套餐" align="center"></el-table-column>
                <el-table-column  prop="address.addressName" label="预约机构地址" align="center"></el-table-column>
                <el-table-column label="操作" align="center">
                    <template slot-scope="scope">
                        <el-button type="primary" size="mini" @click="handleAddress(scope.row)">查看机构详情</el-button>
                        <el-button type="primary"  size="mini" @click="handleSetmeal(scope.row)">查看套餐详情</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination-container">
                <el-pagination
                        class="pagiantion"
                        @current-change="handleCurrentChange"
                        :current-page="pagination.currentPage"
                        :page-size="pagination.pageSize"
                        layout="total, prev, pager, next, jumper"
                        :total="pagination.total">
                </el-pagination>
            </div>
            <div class="add-form">
                <el-dialog title="套餐详情" :visible.sync="dialogFormVisible">
                    <template>
                        <el-tabs v-model="activeName" type="card">
                            <el-tab-pane label="基本信息" name="first">
                                <el-form label-position="right" label-width="100px">
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="编码">
                                                <el-input v-model="formData.code"/>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="套餐名">
                                                <el-input v-model="formData.name"/>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="适用性别">
                                                <el-select v-model="formData.sex">
                                                    <el-option label="不限" value="0"></el-option>
                                                    <el-option label="男" value="1"></el-option>
                                                    <el-option label="女" value="2"></el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="助记码">
                                                <el-input v-model="formData.helpCode"/>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="套餐价格">
                                                <el-input v-model="formData.price"/>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="适用年龄">
                                                <el-input v-model="formData.age"/>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="24">
                                            <el-form-item label="说明">
                                                <el-input v-model="formData.remark" type="textarea"></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="24">
                                            <el-form-item label="注意事项">
                                                <el-input v-model="formData.attention" type="textarea"></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                </el-form>
                            </el-tab-pane>
                        </el-tabs>
                    </template>
                    <!--<div slot="footer" class="dialog-footer">-->
                        <!--<el-button @click="dialogFormVisible = false">取消</el-button>-->
                        <!--<el-button type="primary" @click="handleAdd()">确定</el-button>-->
                    <!--</div>-->
                </el-dialog>
            </div>
            <!-- 编辑标签弹层 -->
            <div class="add-form">
                <el-dialog title="体检机构详情" :visible.sync="dialogFormVisible4Edit">
                    <template>
                        <el-tabs v-model="activeName" type="card">
                            <el-tab-pane label="基本信息" name="first">
                                <el-form label-position="right" label-width="100px">
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="名称">
                                                <el-input v-model="formData1.name"/>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="经度">
                                                <el-input v-model="formData1.longitude"/>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="纬度">
                                                <el-input v-model="formData1.latitude"/>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                </el-form>
                            </el-tab-pane>
                        </el-tabs>
                    </template>
                    <!--<div slot="footer" class="dialog-footer">-->
                        <!--<el-button @click="dialogFormVisible4Edit = false">取消</el-button>-->
                        <!--<el-button type="primary" @click="handleEdit()">确定</el-button>-->
                    <!--</div>-->
                </el-dialog>
            </div>
        </div>
    </div>
</div>
</body>

<script>
    var vue = new Vue({
        el: '#app',
        data:{
                activeName:'first',//添加/编辑窗口Tab标签名称
                pagination: {//分页相关属性
                currentPage: 1,
                pageSize:10,
                total:100,
                queryString:null,
            },
            dataList: [
                sid=null
            ],//列表数据
            formData: {},//表单数据
            formData1:{},
            dialogFormVisible: false,//控制添加窗口显示/隐藏
            dialogFormVisible4Edit:false,//控制编辑窗口的显示/隐藏
            shortcuts: [{
                text: '最近一周',
                onClick(picker) {
                    const end = new Date();
                    const start = new Date();
                    start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                    picker.$emit('pick', [start, end]);
                }
            }, {
                text: '最近一个月',
                onClick(picker) {
                    const end = new Date();
                    const start = new Date();
                    start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                    picker.$emit('pick', [start, end]);
                }
            }, {
                text: '最近三个月',
                onClick(picker) {
                    const end = new Date();
                    const start = new Date();
                    start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                    picker.$emit('pick', [start, end]);
                }
            }],
            value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
        },
        created() {
            this.findPage();
        },
        methods: {
            //分页查询
            findPage() {
                var param={
                    currentPage: this.pagination.currentPage,
                    pageSize: this.pagination.pageSize,
                    queryString: this.pagination.queryString
                }
                axios.post("/order_lzl/findPage.do",param).then((res)=>{
                    // alert(JSON.stringify(res.data))
                    this.dataList=res.data.rows
                    this.pagination.total=res.data.total
                })
            },
            // 重置表单
            // resetForm() {
            //     this.activeName='first'
            //     this.formData= {}
            //     this.imageUrl=null;
            //     this.checkgroupIds=[];
            // },
            //切换页码
            handleCurrentChange(currentPage) {
                this.pagination.currentPage=currentPage
                this.findPage()
            },
            handleDelete(row) {
                this.$confirm("您确定删除该条记录?","提示",{type:'warning'}).then(()=>{
                    axios.get("/order_lzl/delete.do?id="+row.id).then((res)=>{
                        if(res.data.flag){
                            this.findPage()
                            this.$message.success(res.data.message)
                        }else {
                            this.$message.error(res.data.message)
                        }
                    })
                }).catch(()=>{this.$message.info("您已取消删除！")})
            },
            // 弹出机构窗口
            handleAddress(row) {
                this.dialogFormVisible4Edit=true;
                this.activeName='first';
                this.formData1={};
                axios.get("/order_lzl/findAddressByid.do?id="+row.address.aid).then((res)=>{
                    if (res.data.flag) {
                        this.formData1 = res.data.data

                    }else {
                        this.$message.error(res.data.message)
                    }
                })

            },
            // 弹出套餐窗口
            handleSetmeal(row) {

                this.activeName='first'
                this.dialogFormVisible=true
                axios.get("/order_lzl/findSetmealByid.do?id="+row.sid).then((res)=> {
                    if (res.data.flag) {
                        this.formData = res.data.data

                    }else {
                        this.$message.error(res.data.message)
                    }
                })
            },
        }
    })
</script>
</html>
